Explicitly Typed Exceptions for Haskell
نویسنده
چکیده
We describe a monad for checked, explicitly typed exceptions, which provides as a simple Haskell library what for other languages is a native feature. Multi parameter type classes and overlapping instances are the only essential extensions to Haskell 98 required.
منابع مشابه
Signed and sealed
Language constructs for defining abstract types commonly come in two varieties: those that add and remove seals dynamically as values cross the abstraction boundary, and those that define the boundary statically using a type signature. Abstract types in dynamically-typed languages are generally defined using seals whereas statically-typed languages more typically use a signature; two prominent ...
متن کاملA Specification for Dependently-Typed Haskell (Extended version)
We propose a semantics for Dependent Haskell, an extension of Haskell with full-spectrum dependent types. Our semantics consists of two strongly related languages. The rst is a Curry-style dependently-typed language with nontermination, irrelevant arguments, and equality abstraction. The second, strongly inspired by GHC’s core language FC, is its explicitly-typed analogue, suitable for implemen...
متن کاملA Tutorial Implementation of a Dependently Typed Lambda Calculus
We present the type rules for a dependently typed core calculus together with a straightforward implementation in Haskell. We explicitly highlight the changes necessary to shift from a simply-typed lambda calculus to the dependently typed lambda calculus. We also describe how to extend our core language with data types and write several small example programs. The article is accompanied by an e...
متن کاملException Handlers as Extensible Cases
Exceptions are an indispensable part of modern programming languages. They are, however, handled poorly, especially by higherorder languages such as Standard ML and Haskell: in both languages a well-typed program can unexpectedly fail due to an uncaught exception. In this paper, we propose a technique for type-safe exception handling. Our approach relies on representing exceptions as sums and a...
متن کاملExplicit implicit parameters
In almost all languages arguments to functions are to be given explicitly in the program text. There are however a few interesting exceptions to this rule. In Haskell functions take arguments which are either passed explicitly or implicitly. An instance of the latter is the class system in Haskell where dictionaries are passed as evidence for class predicates. However, the construction as well ...
متن کامل